package kr.haggenna.board.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Component;

import kr.haggenna.board.domain.BoardCommand;

@Component
public class BoardDaoImpl extends SqlSessionDaoSupport implements BoardDao{

	@Override
	public List<BoardCommand> list(Map<String, Object> map) {
		List<BoardCommand> list = getSqlSession().selectList("selectList",map);
		return list;
	}

	@Override
	public int getRowCount(Map<String, Object> map) {
		return getSqlSession().selectOne("selectCount",map);
	}

	@Override
	public void insertBoard(BoardCommand boardCommand) {
		getSqlSession().insert("insertBoard", boardCommand);
	}

	@Override
	public BoardCommand selectBoard(int board_num) {
		BoardCommand boardCommand = getSqlSession().selectOne("selectBoard",board_num);
		return boardCommand;
	}

	@Override
	public void modify(BoardCommand boardCommand) {
		getSqlSession().update("updateBoard", boardCommand);
	}

	@Override
	public void delete(Integer num) {
		getSqlSession().delete("deleteBoard", num);
	}

}
